package com.zim.analysis;

import com.zim.analysis.dto.BaseAnlysisDTO;

public class Automatic implements IAnalysis{

    @Override
    public BaseAnlysisDTO anlysis(byte[] bytes) throws Exception {
        if((bytes[1]+bytes[2]+bytes[3])==0) {
            return new SaiKa().anlysis(bytes);
        }else {
            throw new Exception("No analysis vendor");
        }
    }

    @Override
    public byte[] heartBeat(String terminal) throws Exception {
        if("0000000".equals(terminal.substring(0, 7))) {
            return new SaiKa().heartBeat(terminal);
        }else {
            throw new Exception("No analysis vendor");
        }
    }

    @Override
    public byte[] update(String terminal, String version, String ftp) throws Exception {
        if("0000000".equals(terminal.substring(0, 7))) {
            return new SaiKa().update(terminal, version, ftp);
        }else {
            throw new Exception("No analysis vendor");
        }
    }

    @Override
    public byte[] lock(String terminal, boolean bool) throws Exception {
        if("0000000".equals(terminal.substring(0, 7))) {
            return new SaiKa().lock(terminal, bool);
        }else {
            throw new Exception("No analysis vendor");
        }
    }

    @Override
    public byte[] ignite(String terminal, boolean bool) throws Exception {
        if("0000000".equals(terminal.substring(0, 7))) {
            return new SaiKa().ignite(terminal, bool);
        }else {
            throw new Exception("No analysis vendor");
        }
    }

    @Override
    public byte[] whistle(String terminal, boolean bool) throws Exception {
        if("0000000".equals(terminal.substring(0, 7))) {
            return new SaiKa().whistle(terminal, bool);
        }else {
            throw new Exception("No analysis vendor");
        }
    }

    @Override
    public byte[] initBluetooth(String terminal) throws Exception {
        if("0000000".equals(terminal.substring(0, 7))) {
            return new SaiKa().initBluetooth(terminal);
        }else {
            throw new Exception("No analysis vendor");
        }
    }

    @Override
    public byte[] password(String terminal, String password) throws Exception {
        if("0000000".equals(terminal.substring(0, 7))) {
            return new SaiKa().password(terminal, password);
        }else {
            throw new Exception("No analysis vendor");
        }
    }

    @Override
    public byte[] photo(String terminal) throws Exception {
        if("0000000".equals(terminal.substring(0, 7))) {
            return new SaiKa().photo(terminal);
        }else {
            throw new Exception("No analysis vendor");
        }
    }

    @Override
    public byte[] rent(String terminal, int type) throws Exception {
        if("0000000".equals(terminal.substring(0, 7))) {
            return new SaiKa().rent(terminal, type);
        }else {
            throw new Exception("No analysis vendor");
        }
    }

    @Override
    public byte[] secret(String terminal, String productKey, String secret) throws Exception {
        if("0000000".equals(terminal.substring(0, 7))) {
            return new SaiKa().secret(terminal, productKey, secret);
        }else {
            throw new Exception("No analysis vendor");
        }
    }

}
